<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
</head>
<body>
	<div id="register_main" xlvobject="xlv.obj.pane" xlvprop="{glow:{enable:true},border:{enable:true},bkOpacity:true}"
			xlvmethod="{
			styleFor:function(root){
				root.style.background='url(/xlive/images/lightgrayTexture.gif) left top repeat';
			}
		}"
	>
		<div id="register_trigger" xlvobject="xlv.obj.dmTrigger" xlvprop="{dmName:'user',listener:{when:'afterModelChanged',notify:'setChanged',memoType:'create',memoMethods:'register'}}"
			 xlvmethod="{
			 	process:function(options){
			 		var dm=this.getDataModel();
			 		var valid=dm.getValue('register.return.valid');
			 		if('true'==valid){
			 			dm.setValue(dm.getValue('register.data.user-id'),'login.user-id');
			 			dm.setValue(dm.getValue('register.data.user-pass'),'login.user-pass');
						var pane=xlv.util.findParent(this,{id:'register_main'});
						pane.dispose();
						dm.login();
					}else{
						var why=dm.getValue('register.return.why');
						alert('register error :\n'+why);
					}
			 	}
			 }"
		>
		</div>
		<div style="padding:10px;width:400px">
			<table style="font-family:Arial;font-size:12px;text-align:left;">
				<tr>
					<td align="center" valign="middle" id="user_icon" rowSpan="5" style="padding-right:4px">
						<div xlvobject="xlv.obj.webImg"
							 xlvprop="{dmName:'user',dmPath:'register.data.user-icon',width:'64px'}"
						>
						</div>
						<div xlvobject="xlv.obj.webObject" xlvprop="{name:'fs.forum.images',objectURL:'fs.forum.images'}"></div>
						<div id="uploader" 
							 xlvobject="xlv.obj.uploader" style="padding:12px"
				    	 	 xlvprop="{
				    	 		showSubmit:true,
				    	 		promptText:'upload photo',
				    	 		limit:1,
				     			dmName:'fs.forum.images',methodName:'properties.upload',
				     			srcImg:'/xlive/images/_upload.png'
				     			}"
				     		 xlvmethod="{
				     		 	process:function(){
				     		 		this.getDataModel('fs.forum.images').setValue(new Date().getTime()+'_','properties.upload.prefix-file-name');
				     		 		this.$self('process');
				     		 	},
				     		 	uploadResposed:function(valid,why){
				     		 		if(!valid){
				     		 			alert('upload failure :'+why);
				     		 			return;
				     		 		}
				     		 		var dm=this.getDataModel('fs.forum.images');
				     		 		var files=dm.xml_selectNodes('properties/upload/return/data/file');
				     		 		var fn=xlv.util.getElementValue(files[0]);
				     		 		fn='/xlive/images/forum/upload/'+dm.getValue('properties.upload.prefix-file-name')+fn;
				     		 		var userdm=this.getDataModel('user');
				     		 		userdm.setValue(fn,'register.data.user-icon');
				     		 		this.cleanUploadList();
								}
				     		 }"		
						 >
						</div>
					</td>
					<td>user-id</td>
					<td align="left"><div id="user_id" xlvobject="xlv.obj.input" xlvprop="{dmName:'user',dmPath:'register.data.user-id'}"></div>
					</td>
				</tr>
				<tr>
					<td>password</td>
					<td align="left"><div id="user_pass" xlvobject="xlv.obj.input" xlvprop="{password:true,dmName:'user',dmPath:'register.data.user-pass'}"></div>
					</td>
				</tr>
				<tr>
					<td>user-name
					</td>
					<td align="left">
						<div id="user_name" xlvobject="xlv.obj.input" xlvprop="{dmName:'user',dmPath:'register.data.user-name'}"></div>
					</td>
				</tr>
				<tr>
					<td>user-email
					</td>
					<td align="left">
						<div id="user_email" xlvobject="xlv.obj.input" xlvprop="{dmName:'user',dmPath:'register.data.user-email'}"></div>
					</td>
				</tr>
				<tr>
					<td>user-company
					</td>
					<td align="left">
						<div id="user_company" xlvobject="xlv.obj.input" xlvprop="{dmName:'user',dmPath:'register.data.user-company'}"></div>
					</td>
				</tr>
				<tr>
					<td>brief</td>
					<td colSpan="2" align="right">
					<button xlvobject="xlv.obj.dmProcess" xlvprop="{dmName:'user',methodName:'register',srcImg:'/xlive/images/user.png',title:'register'}"
						xlvmethod="{
							process:function(options){
								var rich_editor=this.getObjectById('text_editor');
							 	rich_editor.commit();
								var dm=this.getDataModel();
								var id=dm.getValue('register.data.user-id');
								if(!id||id.strip().length==0) {
									alert('user id is blank');
									return;
								}
								var pass=dm.getValue('register.data.user-pass');
								if(!pass||pass.strip().length==0) {
									alert('password is blank');
									return;
								}
								dm.register();
							}
						}"
					></button>
					<button xlvobject="xlv.obj.dmProcess" xlvprop="{srcImg:'/xlive/images/cancel.png',title:'cancel'}"
						xlvmethod="{
							process:function(options){
								var pane=xlv.util.findParent(this,{id:'register_main'});
								pane.dispose();
							}
						}"
					></button>
					</td>
				</tr>
				<tr>
					<td colSpan="3">
						<div id="text_editor" xlvobject="xlv.obj.richEditor" xlvprop="{dmName:'user',dmPath:'register.data.user-brief'}"></div>
					</td>
				</tr>
				<tr>
					<td>
					</td>
					<td>
					</td>
				</tr>
			</table>
			<!-- <div xlvobject="xlv.obj.tree" xlvprop="{dmName:'user'}"></div>-->
		</div>	
	</div>	
</body>
</html>
